/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Oct 18, 2013  3:53:45 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : com.tis.database.services.staging.impl
 * File Name : ApplicationLogingServicesImpl.java
 * TODO
 */
package com.tis.database.services.staging.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import org.hibernate.HibernateException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tis.database.dao.staging.ApplicationLogingDao;
import com.tis.database.entitys.staging.ApplicationLoging;
import com.tis.database.services.staging.IApplicationLogingServices;

/**
 * @author Chatree Siangklom of Administrator
 * Date =Oct 18, 2013 : 3:53:45 PM 
 * CreateBy=Chatree Siangklom
 * 
 * ApplicationLogingServicesImpl
 * TODO
 */
@Service
@Transactional(readOnly=true)
public class ApplicationLogingServicesImpl implements IApplicationLogingServices {

	private static final Logger logging = LoggerFactory.getLogger(ApplicationLogingServicesImpl.class);

	@Autowired ApplicationLogingDao applicationLogingDao;
	
	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#Search(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int)
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<ApplicationLoging> Search(	String id, 
											String instanceNo,
											String msgCode, 
											String msgDesc, 
											String msgAltDesc,
											String refInstanceNo, 
											String createdOnStart, 
											String createdOnEnd,
											int maxResult) throws HibernateException, Exception {

		return applicationLogingDao.Search(id, instanceNo, msgCode, msgDesc, msgAltDesc, refInstanceNo, createdOnStart, createdOnEnd, maxResult);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#NextSequence()
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public BigDecimal NextSequence() throws HibernateException, Exception {
		
		return applicationLogingDao.NextSequence();
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#saveOrUpdate(com.tis.database.entitys.staging.ApplicationLoging)
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void saveOrUpdate(ApplicationLoging e) {
		
		applicationLogingDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#saveOrUpdate(java.util.List)
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void saveOrUpdate(List<ApplicationLoging> e) {
		
		applicationLogingDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#findById(java.lang.String)
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public ApplicationLoging findById(String id) {
		
		return applicationLogingDao.findById(id);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#findByInstanceNo(java.lang.String, com.tis.database.entitys.staging.ApplicationLoging)
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public List<ApplicationLoging> findByInstanceNo(String instanceNo, ApplicationLoging e) throws HibernateException, Exception {
		
		return applicationLogingDao.findByInstanceNo(instanceNo, e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#NextInstanceNo()
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public BigDecimal NextInstanceNo() throws HibernateException, Exception {
		
		return applicationLogingDao.NextInstanceNo();
	}

	/** (Javadoc)
	 * @see com.tis.database.services.staging.IApplicationLogingServices#getCurrentDatabaseDate()
	 * Date =Oct 18, 2013 : 3:53:45 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public Date getCurrentDatabaseDate() throws HibernateException, Exception {
		
		return applicationLogingDao.getCurrentDatabaseDate();
	}

}
